package com.leyou.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.leyou.item.entity.Sku;
import org.apache.ibatis.annotations.Update;

import java.util.Map;

/**
 * @author 虎哥
 */
public interface SkuMapper extends BaseMapper<Sku> {
    @Update("update tb_sku set stock = stock - #{num},sold = sold + #{num} where id = #{id}")
    int deductStock(Map<String,Object> sku);
    //减库存，同时销量+
    @Update("update tb_sku set stock = stock +#{num},sold = sold - #{num} where id = #{id}")
    int addStock(Map<String,Object> sku);
}